import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DeliveryPlanDetailVO, DeliveryPlanDetailForm, DeliveryPlanDetailQuery } from '@/api/delivery/deliveryPlanDetail/types';

/**
 * 查询发货计划明细列表
 * @param query
 * @returns {*}
 */

export const listDeliveryPlanDetail = (query?: DeliveryPlanDetailQuery): AxiosPromise<DeliveryPlanDetailVO[]> => {
  return request({
    url: '/delivery/deliveryPlanDetail/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询发货计划明细详细
 * @param id
 */
export const getDeliveryPlanDetail = (id: string | number): AxiosPromise<DeliveryPlanDetailVO> => {
  return request({
    url: '/delivery/deliveryPlanDetail/' + id,
    method: 'get'
  });
};

/**
 * 新增发货计划明细
 * @param data
 */
export const addDeliveryPlanDetail = (data: DeliveryPlanDetailForm) => {
  return request({
    url: '/delivery/deliveryPlanDetail',
    method: 'post',
    data: data
  });
};

/**
 * 修改发货计划明细
 * @param data
 */
export const updateDeliveryPlanDetail = (data: DeliveryPlanDetailForm) => {
  return request({
    url: '/delivery/deliveryPlanDetail',
    method: 'put',
    data: data
  });
};

/**
 * 删除发货计划明细
 * @param id
 */
export const delDeliveryPlanDetail = (id: string | number | Array<string | number>) => {
  return request({
    url: '/delivery/deliveryPlanDetail/' + id,
    method: 'delete'
  });
};
